﻿@model AutomatedTestDataManagement.Models.Datum

@{
    ViewBag.Title = "Delete Data Record";
}

<h2>Delete</h2>

<h3>Are you sure you want to delete this record from @ViewBag.TableName?</h3>
<fieldset>
    <legend>Datum</legend>

        @foreach(System.Collections.Specialized.OrderedDictionary item in ViewBag.Data.Values)
        {
            foreach(System.Collections.DictionaryEntry entry in item)
            {
                if (@entry.Key.ToString() != "DataID")
                {
                    <div class="display-label">
                        @entry.Key.ToString()
                    </div>
                    <div class="display-field">
                        @entry.Value.ToString()
                    </div>
                }
            }
        }
         <p>
        </p>
    </fieldset>
@using (Html.BeginForm()) {
    <div>
        @Html.ValidationSummary(true)
        @if(ViewData.ModelState.IsValid)
        {
        <input type="submit" value="Delete" /> @Html.Encode(" | ")
           <input type="hidden" name="TableMasterID" value="@ViewBag.TableMasterID" /> 
           <input type="hidden" name="DataID" value="@ViewBag.DataID" />
            foreach (int datatableID in ViewBag.DataTableIDs)
            {
                <input type="hidden" name="DataTableID" value="@datatableID" />
            }
        }
        else
        {
            <table>
                <tr>
                    <th>Test Step Description</th>
                </tr>
                @foreach (AutomatedTestDataManagement.Models.TestStep step in ViewBag.TestSteps)
                {
                    <tr>
                        <td>@step.StepDescription</td>
                    </tr>
                }

            </table>
        }
        @Html.ActionLink("Back to List", "Index", new { id = ViewBag.TableMasterID })
    </div>
}

        @{Html.RenderAction("_ListDataTables", "DataTable");}

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
